import logging
from datetime import datetime

logging.basicConfig(level=logging.INFO,
                    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)


def ryParams(param: str = None):
    """
    A sample scheduled task method that logs information

    Args:
        param (str, optional): A parameter passed to the method. Defaults to None.

    Returns:
        str: A description of the task execution
    """
    try:
        current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")

        if param:
            log_message = f"Executing ryParams task with parameter '{param}' at {current_time}"
        else:
            log_message = f"Executing ryParams task at {current_time}"

        logger.info(log_message)
        return log_message

    except Exception as e:
        logger.error(f"Error in ryParams task: {str(e)}")
        raise


def ryNoParams(param: str = None):
    """
    A sample scheduled task method that logs information

    Args:
        param (str, optional): A parameter passed to the method. Defaults to None.

    Returns:
        str: A description of the task execution
    """
    try:
        current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")

        if param:
            log_message = f"Executing ryNoParams task with parameter '{param}' at {current_time}"
        else:
            log_message = f"Executing ryNoParams task at {current_time}"

        logger.info(log_message)

        return log_message

    except Exception as e:
        logger.error(f"Error in ryParams task: {str(e)}")
        raise
